function initFileInput(ctrlId, uploadUrl, previewUrl, allowedFileExtensions, showPreview, showRemove, showUpload, showCancel, showClose,
                       minImageWidth, minImageHeight, maxImageWidth, maxImageHeight, minFileSize, maxFileSize) {
    var control = $('#' + ctrlId);
    var config = {};
    config.language = 'zh'; //设置语言
    config.uploadUrl = uploadUrl; //上传的地址
    if(allowedFileExtensions){
        config.allowedFileExtensions = allowedFileExtensions; //接收的文件后缀
    }
    config.previewFileIcon = '<i class="glyphicon glyphicon-king"></i>';
    config.dropZoneTitle = '拖拽图片到这';
    config.browseClass = 'btn btn-primary';

    if(previewUrl){
        config.initialPreview =["<img src='" + previewUrl +"' class='file-preview-image' >",];
    }
    config.showCaption = true; //是否显示被选文件的简介
    config.showBrowse = true; //是否显示浏览按钮
    config.showPreview = showPreview; //是否显示预览区域
    config.showRemove = showRemove; //是否显示移除按钮
    config.showUpload = showUpload; //是否显示上传按钮
    config.showCancel = showCancel; //是否显示取消按钮
    config.showClose = showClose; //是否显示关闭按钮
    config.autoReplace = true; //是否自动替换当前图片，设置为true时，再次选择文件， 会将当前的文件替换掉
    if(minImageWidth){
        config.minImageWidth = minImageWidth; //图片的最小宽度
    }
    if(minImageHeight){
        config.minImageHeight = minImageHeight; //图片的最小高度
    }
    if(maxImageWidth){
        config.maxImageWidth = maxImageWidth; //图片的最大宽度
    }
    if(maxImageHeight){
        config.maxImageHeight = maxImageHeight; //图片的最大高度
    }
    if(minFileSize){
        config.minFileSize = minFileSize; //单位为kb，上传文件的最小大小值
    }
    if(maxFileSize){
        config.maxFileSize = maxFileSize; //单位为kb，如果为0表示不限制文件大小
    }
    var fileActionSettings = {};
    fileActionSettings.uploadClass = 'noneButton';
    fileActionSettings.removeClass = 'noneButton';
    //设置预览图片的显示样式
    config.fileActionSettings = fileActionSettings;
    config.maxFileCount = 1;
    console.log(config);
    //创建对象
    control.fileinput(config);
}

function doInitFileInput(divId, ctrlId, uploadUrl, previewUrl, allowedFileExtensions, showPreview, showRemove, showUpload, showCancel, showClose,
                minImageWidth, minImageHeight, maxImageWidth, maxImageHeight, minFileSize, maxFileSize) {
    $("#" + divId).html("<input id='" + ctrlId + "' name='" + ctrlId + "' type='file'>");
    initFileInput(ctrlId, uploadUrl, previewUrl, allowedFileExtensions, showPreview, showRemove, showUpload, showCancel, showClose,
        minImageWidth, minImageHeight, maxImageWidth, maxImageHeight, minFileSize, maxFileSize);
}